Distributed energy transaction matching method based on energy network constraints and multiple knapsack model

ABSTRACT

This invention provides a distributed energy transaction matching method based on energy network constraints and multiple knapsack model. First, it considers the matching between financial market transactions and actual energy network scheduling, then generates security constraints on the results of distributed transactions. Next, it designs a multiple knapsack model for peer-to-peer distributed transactions, which can meet the common quotation needs of users or producers who issue transactions and achieve efficient matching under energy network security checks. Finally, the model is verified based on the blockchain Ethereum smart contract test verification. This method provides new ideas for the connection between distributed energy trading and actual physical dispatch, proposes an inclusive and efficient matching model for the point-to-point distributed trading market, which has great reference value for the connection between distributed energy trading and actual conditions.

FIELD OF THE INVENTION

The invention belongs to the field of distributed energy trading and particularly relates to quantitative guidance for distributed trading and actual energy dispatch matching rules, and point-to-point energy trading models.

BACKGROUND OF THE INVENTION

With the gradual promotion of distributed energy trading, more and more energy trading links are deployed among users, and a financial-based energy trading market is established. The energy network can perform actual physical transactions for users based on the results of financial market transactions. The transmission has greatly improved the mobility of energy and promoted reform and development in the energy sector.

However, there are still many difficulties in matching transactions and scheduling. Point-to-point transactions between users do not care about the actual physical constraints, while energy network scheduling is a process that needs to meet the physical realization of each energy network, that is, the actual physical constraints and energy flow constraints are strictly considered in the optimal scheduling. Therefore, the actual transaction contract may not completely match the security dispatch. The energy trading system needs to interact with the dispatch during the design process, taking into account the constraints issued by the dispatch.

At the same time, the matching in distributed transactions is a point-to-point problem. How to match and meet the quotation needs of multiple users at the same time has not been solved well. Traditional transactions are executed based on the transaction center, which cannot guarantee the clarity of the process and security. The above-mentioned problems must be solved to promote distributed transactions. Otherwise, the willingness of ordinary users and energy producers to enter the distributed trading market will be greatly weakened, and the distributed transaction cannot be truly realized.

SUMMARY OF THE INVENTION

To solve the problems above, the purpose of the invention is to provide a distributed energy transaction matching method based on energy network constraints and multiple knapsack model and implement algorithms based on blockchain technology to solve the existing problems in distributed transactions, providing new solutions for distributed energy trading and scheduling matching and peer-to-peer transaction matching.

To achieve the above objective, the invention adopts the following technical solutions:

The distributed energy transaction matching method includes the following steps:

(1) By designing an augmented optimization model of energy scheduling, the transaction volume of users is restricted to the smaller value of the declared volume and the energy network limit volume to add security checks for distributed transactions;

(2) Based on the traditional single knapsack model, for the goal of maximizing market transaction value, design a multiple knapsack model fit more with point-to-point transactions to match transactions between multiple buyers and sellers.

The method for matching distributed energy transactions based on energy network constraints and multiple knapsack problems, wherein the augmented optimization model in step (1) is:

$\begin{Bmatrix} {{\max\limits_{x,y}{f\left( {x,y} \right)}} + {\rho^{T}\left( {y^{sp} - y} \right)}} \\ {{{{s.t.\mspace{14mu}{g_{i}\left( {x,y} \right)}} = 0},{i = 1},\ldots\mspace{14mu},N_{eq}}\;} \\ {{{h_{j}\left( {x,y} \right)} \leq 0},{j = 1},\ldots\mspace{14mu},N_{ieq}} \\ {0 \leq y \leq y^{sp}} \end{Bmatrix}\quad$

Where x is the decision variable of the system, y is the load and energy production of the system, y^(sp) is the transaction energy volume determined by the contract, y=y^(sp) indicates that the system's scheduling boundary condition is the transaction volume determined by the contract, and g_(i) and h_(j) are equality and inequality constraints of network system security. The augmented optimization model takes y as the system optimization variable, considers the modification of the existing transaction volume, and ensures that the modification amount is as small as possible so that the impact on the transaction is smaller. After the energy network is checked, the correction amount of the transaction can only reduce or cancel the transaction volume, but cannot force the user to increase transaction volume, so the constraint of 0≤y≤y^(sp) is obtained.

The method for matching distributed energy transactions based on energy network constraints and multiple knapsack model, wherein the objective function of the multiple knapsack model in step (2) is:

$\begin{Bmatrix} {{\max\limits_{P_{g},P_{d}}\;{\sum\limits_{j = 1}^{N_{d}}{\lambda_{d,j}P_{d,j}}}} - {\sum\limits_{i = 1}^{N_{g}}{\lambda_{g,i}P_{g,i}}}} \\ {{s.t.\mspace{14mu}{\sum\limits_{i = 1}^{N_{g}}P_{g,i}}} = {\sum\limits_{\;^{j = 1}}^{N_{d}}P_{d,j}}} \\ {{0 \leq P_{g,i} \leq P_{g,i}^{\max}},{0 \leq P_{d,j} \leq P_{d,j}^{\max}}} \end{Bmatrix}\quad$

λ_(d,j) is the price of the j^(th) user, λ_(g,i) is the price of the i^(th) producer, P_(d,j) is the matched transaction volume of the j^(th) user, P_(g,i) the matched transaction volume of the j^(th) producer, N_(g) and N_(d) is the number of producers and users, P_(d,j) ^(max) and P_(g,i) ^(max) is the maximum possible transaction volume of the j^(th) user and i^(th) producer.

The method for matching distributed energy transactions based on energy network constraints and multiple knapsack model, characterized in that the solving algorithm of the multiple knapsack model is described as:

Convert the point-to-point energy transaction into a multiple knapsack problem. When N_(d)>N_(g), there are N_(d) kinds of commodities placed in N_(g) boxes with a capacity of P_(g,i) ^(max) one after another. The weight of each commodity j is P_(j), and the value of unit weight is λ_(j). The value of the goods is sorted from high to low, and the high-value goods are placed first until the weight reaches the requirement, the next box is replaced and the execution is repeated. When N_(d)≤N_(g), N_(g) types of goods are placed in N_(d) boxes with a capacity of P_(d,j) ^(max) one after another. The weight of a commodity i is P_(i), and the value of unit weight is λ_(i). Sort the value of the commodity from small to large, and put the small value commodity first, until the weight reaches the requirement, change the box and repeat the execution until the condition is not met.

A distributed energy transaction matching method based on energy network constraints and multiple knapsack model is characterized in that the multiple knapsacks solve the point-to-point transaction problem, which is used in conjunction with the decentralized blockchain technically similar features, the algorithm of the multiple knapsack model is written in the Ethereum smart contract using the “Solidity” to solve.

The beneficial effects of the invention are embodied in:

(1) The invention proposes a distributed energy transaction matching method based on energy network constraints and multiple knapsack model. This method can effectively solve the problem of the current energy transaction market and actual dispatching mismatch, imperfect transaction mode, etc. Also, it provides solutions for distributed trading algorithms in blockchain technology.

(2) The invention can add safety checks based on a direct matching of traditional energy transactions, fully consider the scheduling limitations of the energy network, ensure that the transaction results of the financial market meet the realization of actual physical transmission, and solve the matching problem of transactions and scheduling.

(3) The present invention can propose multiple knapsack models for point-to-point multi-party transactions based on the traditional knapsack problem to satisfy market demand and user quotation requirements. At the same time, it is realized based on decentralized blockchain technology to ensure that the transaction process is clear and transparent, safe, and reliable. It can be used in energy distributed trading occasions, so engineering personnel can carry out relevant research work accordingly.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is the flow chart of the energy network security check;

FIG. 2 is the diagram of the transaction matching process;

FIG. 3 shows the matching results without energy grid verification in the calculation example;

FIG. 4 shows the matching results with energy network verification;

FIG. 5 shows the results of the final 7 successful transactions.

DETAILED DESCRIPTION OF THE INVENTION

Further details of the invention are given below in conjunction with the appended drawings and embodiments:

1. The distributed energy transaction matching method based on energy network constraints and multiple knapsack model is implemented through the following steps:

(1) An Augmented Optimization Model for Energy Dispatch

Purely distributed transactions cannot consider the actual operation of energy grid scheduling, because all users cannot fully understand the accurate energy grid model and physical operation mechanism. However, energy trading is often constrained by the safe operation of the actual energy network. Therefore, the matching of trading and scheduling must be considered. The traditional optimal scheduling model of energy can be expressed as (1), where x is the decision variable of the system, y is the load and energy production of the system, y^(sp) is the transaction energy amount determined by the contract, and y=y^(sp) indicates that the system's scheduling boundary condition is the transaction volume determined by the contract. g_(i) and h_(j) are equality and inequality constraints of network system security.

$\begin{matrix} {\begin{Bmatrix} {\max\limits_{x}{f\left( {x,y} \right)}} \\ {{{{s.t.\mspace{14mu}{g_{i}\left( {x,y} \right)}} = 0},{i = 1},\ldots\mspace{14mu},N_{eq}}\;} \\ {{{h_{j}\left( {x,y} \right)} \leq 0},{j = 1},\ldots\mspace{14mu},N_{ieq}} \\ {y = y^{sp}} \end{Bmatrix}\quad} & (1) \end{matrix}$

However, the optimal scheduling model has no feasible solution, which means that for scheduling under a given energy transaction volume, the safe operation constraints will be violated. Therefore, the dispatch needs to check the energy transaction volume to form the following augmented optimization model. Users trade with each other, and at the same time the trading platform interacts with the energy network, check the security of the physical stream transmission. The final transaction result is distributed on the blockchain. The entire process is shown in FIG. 1.

$\begin{matrix} {\begin{Bmatrix} {{\max\limits_{x,y}{f\left( {x,y} \right)}} + {\rho^{T}\left( {y^{sp} - y} \right)}} \\ {{{{s.t.\mspace{14mu}{g_{i}\left( {x,y} \right)}} = 0},{i = 1},\ldots\mspace{14mu},N_{eq}}\;} \\ {{{h_{j}\left( {x,y} \right)} \leq 0},{j = 1},\ldots\mspace{14mu},N_{ieq}} \\ {0 \leq y \leq y^{sp}} \end{Bmatrix}\quad} & (2) \end{matrix}$

Among them, the augmented optimization model takes y as the optimization variable of the system, considering the modification of the existing transaction volume, and ensures that the modification amount is as small as possible, so that the impact on the transaction is smaller. It should be noted that after the energy network is checked, the correction amount of the transaction can only reduce or cancel the transaction volume, but cannot force the user to increase transaction volume, so the constraint of 0≤y≤y^(sp) is obtained.

(2) Multiple Knapsack Model Design Process Under a Safety Check

1) Establish an Initial Transaction Matching Model

In the matching stage, the same subject can be both producer and consumer in different periods, but the subject can only have one identity at one trading node. In this case, the main task of the energy trading system is to match the amount of energy to the greatest extent, while satisfying some transaction volume constraints given by the energy network check, so that more transactions are successful, and the transaction price is determined according to the market quotation. Set λ_(d,j) as the quotation of the j^(th) user, λ_(g,i) as the quotation of the i^(th) producer, P_(d,j) as the matching transaction volume of the j^(th) user, and set P_(g,i) as the matching transaction volume of the i^(th) producer. N_(g) and N_(d) are the numbers of producers and users. Because the transaction to be matched originates from the multi-party participants of the energy trading platform, the quotations of the buyer and the seller can be generated at any time, and the transaction can be completed once the price matches, it is attributed to a continuous double auction mechanism.

First, confirm the supply and demand relationship based on the current market volume. When N_(d)>N_(g) it is the situation when demand exceeds supply. When N_(d)≤N_(g) it is the situation when supply exceeds demand. Based on this, the following matching transaction model is established.

$\begin{matrix} {\begin{Bmatrix} {{\max\limits_{P_{g},P_{d}}\;{\sum\limits_{j = 1}^{N_{d}}{\lambda_{d,j}P_{d,j}}}} - {\sum\limits_{i = 1}^{N_{g}}{\lambda_{g,i}P_{g,i}}}} \\ {{s.t.\mspace{14mu}{\sum\limits_{i = 1}^{N_{g}}P_{g,i}}} = {\sum\limits_{\;^{j = 1}}^{N_{d}}P_{d,j}}} \\ {{0 \leq P_{g,i} \leq P_{g,i}^{\max}},{0 \leq P_{d,j} \leq P_{d,j}^{\max}}} \end{Bmatrix}\quad} & (3) \end{matrix}$

Among them, P_(d,j) ^(max) and P_(g,i) ^(max) is the maximum possible transaction volume of the j^(th) user and the i^(th) producer, and determined by: P _(g,i) ^(max)=min(U _(g,i) ,P _(g,i) ^(bid)),P _(d,j) ^(max)=min(U _(d,j) ,P _(d,j) ^(bid))  (4)

P_(d,j) ^(bid) and P_(g,i) ^(bid) are declaration amount of the j^(th) user and the i^(th) producer, U_(d,j) and U_(g,i) are limits of the j^(th) user and the i^(th) producer after energy network dispatch checking.

2) Design Multiple Knapsack Solution Ideas

It can be seen that the above optimization model is a linear optimization problem with only one equality constraint and upper and lower bound constraints. Such a special linear optimization problem is transformed into a continuous knapsack problem. When supply exceeds demand, N_(d)>N_(g), the problem can be described from the perspective of the knapsack problem as: We have N_(d) kinds of commodities placed in N_(g) boxes with a capacity of P_(g,i) ^(max) one after another. The weight of each commodity j is P_(j), and the value of unit weight is λ_(j), then how to load commodities to maximize the total value? The solution idea of the algorithm is: sort the value of the goods from high to low, and place the goods of high value first until the weight reaches the requirement. When N_(d)≤N_(g), there are N_(g) kinds of commodities placed in N_(d) boxes with a capacity of P_(d,j) ^(max) one after another. The weight of each commodity i is P_(i), and the value of unit weight is λ_(i). The value of the commodities is sorted from low to high, and the low value is first installed. Then change the box and repeat until the conditions are not met.

3) Algorithm Solution Design Based on Blockchain Smart Contract Definition

-   -   i. The corresponding transaction volume of the i^(th) producer         and the j^(th) user which constitutes a i×j dimensional         transaction volume matrix P;     -   ii. The corresponding transaction price of the i^(th) producer         and the j^(th) user is λ_(ij), which constitutes a i×j         dimensional transaction volume matrix λ;     -   iii. The remaining amount of the i^(th) producer's transaction         is P_(g,i) ^(Δ);     -   iv. The remaining transaction amount of the j^(th) user is         P_(d,j) ^(Δ).

Input: The maximum possible transaction volume and quotation of both buyers and sellers, as the following matrix:

$\begin{matrix} \begin{Bmatrix} {P_{d} = \left( {P_{d,1}^{\max},P_{d,2}^{\max},\ldots\mspace{14mu},P_{d,N_{d}}^{\max}} \right)^{T}} \\ {P_{g} = \left( {P_{g,1}^{\max},P_{g,2}^{\max},\ldots\mspace{14mu},P_{g,N_{g}}^{\max}} \right)^{T}} \\ {\lambda_{d} = \left( {\lambda_{d,1},\lambda_{d,2},\ldots\mspace{14mu},N_{d,N_{d}}} \right)^{T}} \\ {\lambda_{g} = \left( {\lambda_{g,1},\lambda_{g,2},\ldots\mspace{14mu},\lambda_{g,N_{g}}} \right)^{T}} \end{Bmatrix} & (5) \end{matrix}$

Output: Transaction volume matrix P and transaction price matrix λ.

Initialize: i=1; j=1; P=0; λ=0.

Run:

 1 IF N_(d) > N_(g), then:  2  Sort from largest to smallest for λ_(d), the sort set is   λ_(I₁), λ_(I₂), …  , λ_(I_(N_(d)));  3  IF i ≤ N_(g), then:  4   p_(g,i) ^(Δ) = P_(g,i) ^(max); P_(d,j) ^(Δ) = P_(d,j) ^(max);  5   When P_(g,i) ^(Δ) − P_(ij) ≥ 0 and λ_(I) _(j) ≥ λ_(g,i), repeat execution:  6    P_(ij) ← P_(I) _(j) ;  7    P_(g,i) ^(Δ) ← P_(g,i) ^(Δ) − P_(ij);  8    P_(d,j) ^(Δ) ← 0;  9    j ← j + 1; 10   Or: 11    P_(ij) ← P_(g,i) ^(Δ); 12    P_(g,i) ^(Δ) ← 0; 13    P_(d,j) ^(Δ) ← P_(d,j) ^(Δ) − P_(ij); 14    i ← i + 1; 15  Or: 16    $\lambda_{ij} = \left\{ {\begin{matrix} \lambda_{d,j} & {P_{ij} > 0} \\ 0 & {P_{ij} = 0} \end{matrix},{j = 1},2,\ldots\mspace{14mu},N_{d}} \right.$ 17 End 18 IF N_(d) ≤ N_(g), then: 19   Sort from smallest to largest for λ_(g), the sort set is    λ_(I₁), λ_(I₂), …  , λ_(I_(N_(g))); 20   IF j ≤ N_(d), Then: 21    P_(d,j) ^(Δ) = P_(d,j) ^(max); P_(g,i) ^(Δ) = P_(g,i) ^(max); 22    When P_(d,j) ^(Δ) − P_(ij) ≥ 0 and λ_(I) _(i) ≤ λ_(d,j), repeat execution: 23     P_(ij) ← P_(I) _(i) ; 24     P_(d,j) ^(Δ) ← P_(d,j) ^(Δ) − P_(ij); 25     P_(g,i) ^(Δ) ← 0; 26     i ← i + 1; 27   Or: 28   P_(ij) ← P_(d,j) ^(Δ); 29   P_(d,j) ^(Δ) ← 0; 30   P_(g,i) ^(Δ) ← P_(g,i) ^(Δ) − P_(ij); 31   j ← j + 1; 32  Or: 33    $\lambda_{ij} = \left\{ {\begin{matrix} \lambda_{g,i} & {P_{ij} > 0} \\ 0 & {P_{ij} = 0} \end{matrix},{i = 1},2,\ldots\mspace{14mu},N_{g}} \right.$ 34 End

Further, we can get

a) The optimal transaction volume for users and producers is

$\begin{matrix} \left\{ \begin{matrix} {{P_{g,i}^{*} = {P_{g,i}^{\max} - P_{g,i}^{\Delta}}},{i = 1},2,\ldots\mspace{14mu},N_{g}} \\ {{P_{d,j}^{*} = {P_{d,j}^{\max} - P_{d,j}^{\Delta}}},{j = 1},2,\ldots\mspace{14mu},N_{d}} \end{matrix} \right. & (6) \end{matrix}$

b) When N_(d)>N_(g), transaction income of the i^(th) producer is

${\sum\limits_{j = 1}^{N_{d}}{\lambda_{ij}P_{ij}}},$ j=1, 2, . . . , N_(d), which is

${\sum\limits_{j = 1}^{N_{d}}{\left( {\lambda_{ij} - \lambda_{g,i}} \right)P_{ij}}},{j = 1},2,\ldots\mspace{14mu},N_{d}$ higher than expected earnings of the quoted price.

c) When N_(d)≤N_(g), Transaction outcome of the j^(th) user is

${\sum\limits_{i = 1}^{N_{g}}{\lambda_{ij}P_{ij}}},$ i=1, 2, . . . , N_(g), which is

${\sum\limits_{i = 1}^{N_{g}}{\left( {\lambda_{d,j} - \lambda_{ij}} \right)P_{ij}}},{i = 1},2,\ldots\mspace{14mu},N_{g}$ lower than the expected cost of the quoted price.

(3) Analysis of Interaction Between Energy Network and Blockchain System

Further, consider the interaction of energy network constraints and blockchain systems as shown in FIG. 2. After the energy trading system obtains the amount of the transaction to be matched, upload it to the energy network for safety verification. If the verification is passed, the smart contract command is triggered to facilitate the transaction. If the transaction fails, the energy network will return the transaction volume constraint, and similarly, multiple blockchain systems can interact with the energy network.

At the beginning of the transaction, it is possible to directly match the transaction without considering the network security constraints to obtain the result of the match-making transaction y₀ ^(sp)=(P_(g,i)*,P_(d,j)*). If the check is unsuccessful, execute the augmented optimization model (2), and the result must be y₀*≤y₀ ^(sp). The transaction volume constraint y₀* is transferred to the matching model. According to (4), it can be seen that the result of the matching transaction meets the feasibility of the model, and there must be y₁ ^(sp)≤y₀*. Further, there are y₁ ^(sp)≤y₀*≤y₀ ^(sp). It can be seen that with the iteration of the energy network and the blockchain transaction system, a sequence (y₀ ^(sp), y₁ ^(sp), . . . ) can be obtained. The sequence is monotonically decreasing and has a lower bound, that is, the Cauchy sequence, so it must converge.

2. Case Analysis

After the method of the invention is realized based on the smart contract of blockchain, the following scenario is set up: in this calculation example, there are 13 users, including 8 sellers and 5 buyers, simulating the market situation as oversupply. Assuming that there are already 8 sellers and 5 buyers in the market and post transactions in sequence to Table 1. It is stipulated that the type of energy traded is testing energy, and the transaction volume applied by 13 users is generated at their own will. The quotation range for the test energy is between 30.00 and 50.00 cents.

(1) Comparison Between the Situation with or without Energy Network Constraints

First, transaction results that do not consider energy network security constraints are shown in Table 1, it can be seen that some users with reasonable prices have successfully traded.

TABLE 1 Information released by users Amount Remaining Release State (kw · h) amount (kw · h) price (cents) Buyer A Finished 350 0 38.00 B Finished 300 0 40.00 C Unfinished 450 450 35.00 D Finished 500 0 39.00 E Finished 500 0 46.00 Seller F Finished 200 0 31.00 G Finished 450 0 39.00 H Unfinished 50 50 46.00 I Finished 150 0 34.00 J Finished 200 0 43.00 K Unfinished 150 150 44.00 L Finished 350 0 37.00 M Finished 300 0 33.00

Next, get the results of all matched transactions in the blockchain. Eight successful transactions generate new blocks, and the generated information is divided into transaction information and block information, as shown in FIG. 3. Here the block height, Nonce and Difficulty in the block information are displayed.

Furthermore, suppose that the actual trading volume of 5 buyers is constrained by the security of the energy network, and the constraints are shown in Table 2. New transaction results are shown in FIG. 4. It can be seen that the transaction results with or without energy network constraints are different. Take users A and B as an example, in unconstrained condition, users A and B bought all energy sold by users F, M, and I, resulting in user C could not match the energy that meets the quotation, and his transaction failed. In constraints of the energy network, the purchase volume of A and B was constrained, also, M and I still had surplus energy, and C successfully bought in batches. It can be seen that results that contain energy network constraints are more in line with actual physical conditions.

TABLE 2 Energy network constraints and correction values Users A B C D E Initially Volume (kw · h) 350 300 unsettled 500 500 Constrained Volume (kw · h) 250 200 200 350 450 Final Volume (kw · h) 250 200 200 350 450

(2) Analysis of Actual Transaction Results

From the above transaction information, it can be seen that in the whole process, 7 transactions were finally completed in sequence. The transaction volume and transaction price are shown in FIG. 5 in order. As buyers entered the market, low-cost energy had been sold off, and the transaction price gradually increased. The transaction volume was determined by the need of buyers and sellers. At the same time, in such a market where supply exceeded demand, buyers had more initiative. After buyers entered the market, the system would sort all the current sellers' quotations from low to high, and matched them with buyers in turn.

For example, user A asked for purchase at 38.00 (cents) and release volume of 250 (kw·h), and finally succeeded at 31.00 (cents) for 200 (kw·h) and 33.00 (cents) for 50 (kw·h), that is, buyers' purchase price was less than or equal to his published price. Of course, the sellers' purchase price would not be lower than his published price, which is in line with the expectation of matching results. Besides, some users' quotations were too deviated to complete a transaction. For example, users C and D, after entering the market, the amount of energy available to meet their published prices was less than their needs, so only part of the transaction could be traded, and the rest part would continue to be saved in the market waiting for conditions to be met.

For sellers, H, J, K, the reason they did not complete the transaction is that user H's selling price was higher than all buyers' quotations at that time, so it would not be matched. Although quotations were relatively suitable for users J, K, there were competitors with lower selling prices in the market and the quantity meet needs of buyers, so there was no transaction.

Furthermore, the transaction cost is further quantitatively analyzed in Table 3. The preferential rate represents the ratio of the actual cost to the expected cost. It can be seen that all 5 buyers have received different discounts.

TABLE 3 Transaction cost analysis Users A B C D E Expected cost (cerds) 9500 8000 7000 13650 20700 Actual cost (ccats) 7850 6600 6750 12950 17550 Discount rate (%) 82.63 82.5 96.43 94.87 84.78

Actual calculation examples above can summarize that: 1) The entire transaction process is implemented according to the logic designed by the smart contract and energy trading system, and it scientifically complies with energy network security check and analyzes user's quotations based on the market situation; 2) Based on the blockchain technology, the energy trading platform can let each transaction data on the chain to generate blocks, and the block data is open and transparent; 3) While protecting interests of both parties, it can save costs, improve transaction efficiency and user experience. 

The invention claimed is:
 1. A distributed energy transaction matching and dispatching method based on energy network constraints and a multiple knapsack model, comprising: restricting a maximum possible transaction volume of each of users including buyers and sellers, through an energy trading platform and a blockchain distributed transaction systems all connected with an energy network, to be a smaller value of a declared volume and an energy network limit volume through security checks for distributed transactions on the energy network according to an augmented optimization model of energy scheduling, wherein the augmented optimization model is configured to take y as a system optimization variable, consider a modification of an existing transaction volume, and ensure that a modification amount is as small as possible making an impact on transaction is smaller; obtaining a constraint condition of 0<y<y^(sp) preventing a mismatch between a current energy transaction market and an actual dispatching by restricting the modification amount of transaction being only capable of reducing or cancelling the existing transaction volume rather than forcing the user to increase transaction volume after the energy network is checked, wherein the augmented optimization model is: $\begin{Bmatrix} {{\max\limits_{x,y}{f\left( {x,y} \right)}} + {\rho^{T}\left( {y^{sp} - y} \right)}} \\ {{{{s.t.\mspace{14mu}{g_{i}\left( {x,y} \right)}} = 0},{i = 1},\ldots\mspace{14mu},N_{eq}}\;} \\ {{{h_{j}\left( {x,y} \right)} \leq 0},{j = 1},\ldots\mspace{14mu},N_{ieq}} \\ {0 \leq y \leq y^{sp}} \end{Bmatrix}{\quad,}$ where x is a decision variable of each of the distributed transaction systems, y is a load and energy production of each of the distributed transaction systems, y^(sp) is a transaction energy volume determined by an Ethereum contract, y=y^(sp) indicates that a scheduling boundary condition of each of the distributed transaction systems is the transaction energy volume determined by the Ethereum contract, and g_(i) and h_(j) are respectively equality and inequality constraints of energy network security; matching transactions between the buyers and the sellers, by a energy trading system according to the maximum possible transaction volumes of the users and quotations of the buyers and the sellers and obtaining transaction results for the users according to a solving algorithm of the multiple knapsack model fit with peer-to-peer transactions; uploading the matched transaction, by the energy trading system to the energy network for safety verification based on energy constraints of the declared volume and the energy network limit volume; verifying the matched transaction with the energy constraints and facilitating the transaction by smart contract of a blockchain distributed transaction system; and performing, by the energy network, actual physical stream transmissions of energy for the users based on the verified matched transaction results.
 2. The distributed energy transaction matching and dispatching method according to claim 1, wherein an objective function of the multiple knapsack model is: $\begin{Bmatrix} {{\max\limits_{P_{g},P_{d}}\;{\sum\limits_{j = 1}^{N_{d}}{\lambda_{d,j}P_{d,j}}}} - {\sum\limits_{i = 1}^{N_{g}}{\lambda_{g,i}P_{g,i}}}} \\ {{s.t.\mspace{14mu}{\sum\limits_{i = 1}^{N_{g}}P_{g,i}}} = {\sum\limits_{\;^{j = 1}}^{N_{d}}P_{d,j}}} \\ {{0 \leq P_{g,i} \leq P_{g,i}^{\max}},{0 \leq P_{d,j} \leq P_{d,j}^{\max}}} \end{Bmatrix}\quad$ where λ_(d,j) is the quotation of a j^(th) buyer, λ_(g,i) is the quotation of an i^(th) seller, P_(d,j) is a matched transaction volume of the j^(th) buyer, P_(g,i) a matched transaction volume of the j^(th) seller, N_(g) and N_(d) are respectively the numbers of the sellers and buyers, P_(d,j) ^(max) and P_(g,i) ^(max) are respectively maximum possible transaction volumes of the j^(th) buyer and i^(th) seller.
 3. The distributed energy transaction matching and dispatching method according to claim 2, wherein the solving algorithm of the multiple knapsack model is described as: converting the peer-to-peer energy transaction into a multiple knapsack problem; wherein when N_(d)>N_(g), placing N_(d) kinds of commodities into N_(g) boxes with a capacity of P_(g,i) ^(max) one after another, where a weight of each commodity j is P_(j), and a value of unit weight is λ_(j); sorting values of the commodities from high to low, placing a high-value commodity first into the boxes until the weight reaches requirements, and repeating a same execution to a next box until the requirements are not met; wherein when N_(d)≤N_(g), placing N_(g) kinds of goods into N_(d) boxes with a capacity of P_(d,j) ^(max) one after another, where a weight of each commodity i is P_(i), and a value of unit weight is λ_(i); sorting values of the commodities from small to large, placing a small value commodity first until the weight reaches requirements, and repeating a same execution to a next box until the requirements are not met.
 4. The distributed energy transaction matching and dispatching method according to claim 3, wherein the multiple knapsack model is configured to solve a problem of the peer-to-peer transactions, which is used in conjunction with the decentralized blockchain technically similar features, the solving algorithm of the multiple knapsack model is written in the Ethereum contract using a “Solidity” to solve the problem. 